package com.qf.day15.sort;

import com.qf.day13.ddz.PukeCard;
import com.qf.day13.ddz.PukeCardUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class SortDemo {

    public static void main(String[] args) {
//        test1();

        List<PukeCard> pukeList = PukeCardUtils.createPukeList();
        PukeCardUtils pukeCardUtils = new PukeCardUtils();
        pukeCardUtils.drawCards(pukeList);

        ArrayList<PukeCard> p1 = pukeCardUtils.getP1();
        System.out.println(p1);
        // 排序

        // 按照扑克的value排序
//        p1.sort((x,y)->x.getValue()-y.getValue());
//        System.out.println(p1);

//        p1.sort((x,y)->x.getPoint().compareTo(y.getPoint()));
//        System.out.println(p1);

        p1.sort((a,b)->a.getType().compareTo(b.getType()));
        System.out.println(p1);

    }

    private static void test1() {
        Random random = new Random();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(random.nextInt(100));
        }
        System.out.println(list);

//        排序
        list.sort( (x,y)->x-y );
        System.out.println(list);

        Collections.sort(list);
        System.out.println(list);
    }

}
